package com.hyperf.core.util;

import com.hyperf.core.exception.CustomException;
import com.hyperf.core.exception.ExceptionInfo;

/**
 * @author lizhaoyang
 */
public final class ExceptionUtil {

    /**
     * 抛出自定义异常
     *
     * @param errorMessage
     * @throws CustomException
     */
    public static void cast(String errorMessage) throws CustomException {
        throw new CustomException(errorMessage);
    }

    /**
     * 抛出自定义异常
     *
     * @param errorCode
     * @param errorMessage
     * @throws CustomException
     */
    public static void cast(int errorCode, String errorMessage) throws CustomException {
        throw new CustomException(errorCode, errorMessage);
    }

    /**
     * 抛出自定义异常
     *
     * @param exceptionInfo
     * @throws CustomException
     */
    public static void cast(ExceptionInfo exceptionInfo) throws CustomException {
        throw new CustomException(exceptionInfo);
    }
}
